/*
 * CS_IOS_SEND_GIFT_SHOW.cpp
 *
 *  Created on: 2013. 9. 11.
 *      Author: mega@gamevil.com
 */

#define	 SEND_GIFT_CONFIG_TYPE		99
#define SEND_GIFT_CONFIG_SUBTYPE	0

#include "../../Command.h"
#include "../../User.h"
#include "../../NResource/Static.h"

namespace ProjectZ { namespace NCommand {

void Command::CS_IOS_SEND_GIFT_SHOW(User * pUser, ::Network::Packet * pPacket)
{
	PREPARE_PACKET;

	NResource::CommonData::Key clsKey(SEND_GIFT_CONFIG_TYPE, SEND_GIFT_CONFIG_SUBTYPE);

	NResource::CommonData::Flyweight * pFly =
			NResource::Static::InstancePtr()->GetCommon()->GetFly(pUser, clsKey);


	::Network::Packet * pAck = ::Network::GETPACKETPOOL()->SEND_NEW();

	if (pFly == NULL)
	{
		DEBUGLOG("CS_IOS_SEND_GIFT_SHOW : pFly is NULL!!! company=%d, sale_cd=%d",
				pUser->GetUserInfo().company, pUser->GetUserInfo().sale_code);

		*pAck << static_cast<int16_t>(ACK_UNKNOWN_ERROR);
		*pAck << static_cast<char>(0);
		pAck->MakePacket(CMD_SC_IOS_SEND_GIFT_SHOW);
		pUser->Send(pAck);
		return;
	}

	PROCESSLOG("CS_IOS_SEND_GIFT_SHOW : company=%d, salecode=%d, value=%d", pUser->GetCompany(), pUser->GetSaleCode(), pFly->_VALUE1);

	*pAck << static_cast<int16_t>(ACK_OK);
	*pAck << static_cast<char>(pFly->_VALUE1);
	pAck->MakePacket(CMD_SC_IOS_SEND_GIFT_SHOW);
	pUser->Send(pAck);
}

} /*NCommand*/ } /*ProjectZ*/
